<template>
    <div>
        <Table border :columns="columns" :data="tableData"></Table>
    </div>
</template>

<script>
import ajax from '../../../../libs/axios.js'
export default {
    props: {
        tableData: Array,
        access: Object
    },
    data () {
        return {
            removeModel:false,
            columns: [
                {
                    title: '序号',
                    type: 'index',
                    width: 80,
                    align: 'center'
                },
                {
                    title: '企业名称',
                    align: 'center',
                    key: 'name',
                    width: 260,
                },
                {
                    title: '手机号码',
                    align: 'center',
                    key: 'legalPhone',
                    width: 180,
                },
                {
                    title: '法人名称',
                    align: 'center',
                    width: 100,
                    key: 'legalPerson'
                },
                {
                    title: '来源',
                    align: 'center',
                    width: 80,
                    key: 'dataSource',
                    render: (h, params) => {
                        if (params.row.dataSource === 1) {
                            return h('span', '前端')
                        }  else if(params.row.status === 2) {
                            return h('span', '后台')
                        } else {
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '状态',
                    align: 'center',
                    width: 100,
                    key: 'status',
                    render: (h, params) => {
                        if (params.row.status === 1) {
                            return h('span', '待审核')
                        }  else if(params.row.status === 2) {
                            return h('span', '审核成功')
                        }else if(params.row.status === 3) {
                            return h('span', '审核失败')
                        }else{
                            return h('span', '其他')
                        }
                    }
                },
                {
                    title: '创建时间',
                    align: 'center',
                    key: 'crtTime',
                    width: 180,
                },
                {
                    title: '操作',
                    key: 'action',
                    width: 210,
                    fixed: 'right',
                    align: 'center',
                    render: (h, params) => {
                        return h('div', [
                            h(
                                'Button',
                                {
                                    props: {
                                        type: 'primary',
                                        size: 'small'

                                    },
                                    style: {
                                        marginRight: '5px',
                                        display: this.access.edit === true ? 'inline-block' : 'none'
                                    },
                                    on: {
                                        click: () => {
                                            this.infoData(params.row.id)
                                        }
                                    }
                                },
                                '详情'
                            ),
                            h(
                                'Button',
                                {
                                    props: {
                                        type: 'success',
                                        size: 'small'
                                    },
                                    style: {
                                        display: this.access.func === true? 'inline-block' : 'none'
                                    },
                                    on: {
                                        click: () => {
                                             this.editInfo(params.row.id)
                                        }
                                    }
                                },
                                '准入'
                            )
                        ])
                    }
                }
            ],
            data: []
        }
    },
    activated () {
        this.init()
    },
    methods: {
        // 初始化数据
        init () {},
        // 准入
        editInfo(id){
            let argu = {
                id: id
            }
            this.$router.push({
                name: 'editbankinginfo',
                params: argu

            })
        },
        // 详情
        infoData (id) {
            let argu = {
                id: id
            }
            this.$router.push({
                name: 'editbankinginfo',
                params: argu

            })
        },
    },
}
</script>
